<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Chronology</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Chronology' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../inform7n.html">Inform7</a></li><li><a href="index.html">runtime</a></li><li><a href="index.html#5">Chapter 5: Provision Submodules</a></li><li><b>Chronology</b></li></ul></div>
<p class="purpose">To compile the chronology submodule for a compilation unit, which contains _past_condition and _action_history_condition packages.</p>

<ul class="toc"><li><a href="5-chr.html#SP1">&#167;1. Plugin</a></li><li><a href="5-chr.html#SP2">&#167;2. Past tense conditions</a></li><li><a href="5-chr.html#SP6">&#167;6. Action history conditions</a></li><li><a href="5-chr.html#SP9">&#167;9. Utility</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Plugin.</b>A little awkwardly, these two features make up the "chronology" feature. There
are arguments for and against making these features doctrinally part of Basic
Inform: or at least for making past tense conditions part of it. But Basic
Inform has no concept of "turns", for example.
</p>

<p class="commentary">In any case, for now, these features are an optional feature, but the activation
function does nothing:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Chronology::start_feature</span><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. Past tense conditions.</b>Each past tense condition, such as "if the green door has been open", causes
one of these objects to be created, which records that we have to keep track
of something &mdash; in this case, whether or not the green door is open.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">past_tense_condition_record</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">condition</span><span class="plain-syntax">; </span><span class="comment-syntax"> condition to be evaluated</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">action_pattern</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ap_to_test</span><span class="plain-syntax">; </span><span class="comment-syntax"> condition to be evaluated</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">where_ptc_tested</span><span class="plain-syntax">; </span><span class="comment-syntax"> sentence in which condition is found</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ptc_package</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ptc_iname</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">past_tense_condition_record</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure past_tense_condition_record is private to this section.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>This is called when a past tense condition is needed. The idea is simple
enough &mdash; we make a note to compile code monitoring whether the green door
is open, which will end up being a "past state"; but for now we only call
a function which tests that past state.
</p>

<p class="commentary">Things are more complicated if the condition is an action pattern, as in
"if we have taken something portable for the third time". There are a few
easy cases &mdash; e.g., "if we have taken" can be resolved using the action
bitmap which always exists, and therefore does not need any request for a
past state to be maintained.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Chronology::compile_past_tense_condition</span><span class="plain-syntax">(</span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tense_indicator</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">time_period</span><span class="plain-syntax"> *</span><span class="identifier-syntax">duration</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_condition_tense</span><span class="plain-syntax">(</span><span class="identifier-syntax">tense_indicator</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">grammatical_usage</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gu</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_tense_marker</span><span class="plain-syntax">(</span><span class="identifier-syntax">tense_indicator</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">tense</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">gu</span><span class="plain-syntax">)?(</span><span class="identifier-syntax">Lcon::get_tense</span><span class="plain-syntax">(</span><span class="identifier-syntax">Stock::first_form_in_usage</span><span class="plain-syntax">(</span><span class="identifier-syntax">gu</span><span class="plain-syntax">))):</span><span class="identifier-syntax">IS_TENSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cond</span><span class="plain-syntax"> = </span><span class="identifier-syntax">tense_indicator</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">action_pattern</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ap</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">tense</span><span class="plain-syntax"> != </span><span class="identifier-syntax">IS_TENSE</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">AConditions::is_action_TEST_VALUE</span><span class="plain-syntax">(</span><span class="identifier-syntax">cond</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ap</span><span class="plain-syntax"> = </span><span class="identifier-syntax">AConditions::pattern_from_action_TEST_VALUE</span><span class="plain-syntax">(</span><span class="identifier-syntax">cond</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="5-chr.html#SP3_1" class="named-paragraph-link"><span class="named-paragraph">Avoid the Ron Newcomb Moment</span><span class="named-paragraph-number">3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="5-chr.html#SP3_2" class="named-paragraph-link"><span class="named-paragraph">Divert an easy case to a simple bitmap lookup</span><span class="named-paragraph-number">3.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">tense</span><span class="plain-syntax"> = </span><span class="identifier-syntax">IS_TENSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">turns_flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">perfect_flag</span><span class="plain-syntax"> = ((</span><span class="identifier-syntax">tense</span><span class="plain-syntax">)/2)%2,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">past_flag</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">tense</span><span class="plain-syntax">)%2;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Occurrence::units</span><span class="plain-syntax">(</span><span class="identifier-syntax">duration</span><span class="plain-syntax">) == </span><span class="identifier-syntax">TURNS_UNIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">turns_flag</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">op</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Occurrence::operator</span><span class="plain-syntax">(</span><span class="identifier-syntax">duration</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">op</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NO_REPM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">past_flag</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">perfect_flag</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">)) </span><span class="identifier-syntax">op</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EQ_REPM</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">op</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GE_REPM</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">id_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-chr.html#SP3_3" class="named-paragraph-link"><span class="named-paragraph">Make a record of this and queue a request to compile a function to monitor it</span><span class="named-paragraph-number">3.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-chr.html#SP3_4" class="named-paragraph-link"><span class="named-paragraph">Compile a call to TESTSINGLEPASTSTATE</span><span class="named-paragraph-number">3.4</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3_1" class="paragraph-anchor"></a><b>&#167;3.1. </b>A treacherous issue named after its discoverer:
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Avoid the Ron Newcomb Moment</span><span class="named-paragraph-number">3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">duration</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Occurrence::units</span><span class="plain-syntax">(</span><span class="identifier-syntax">duration</span><span class="plain-syntax">) == </span><span class="identifier-syntax">TIMES_UNIT</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">Occurrence::length</span><span class="plain-syntax">(</span><span class="identifier-syntax">duration</span><span class="plain-syntax">) &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_NoMoreRonNewcombMoment</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"a condition like 'we have X', where X is an action, has either happened for "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"one spell or never happened at all"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"so it can't make sense to ask if it has happened two or more times. For "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"instance, at the start of play 'we have jumped' is false, but once the "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"player types JUMP, 'we have jumped' will then be true for the rest of time. "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"'We have jumped for the second time' doesn't mean the jumping happened "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"twice, it means the having-jumped has happened twice, which is impossible."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-chr.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_2" class="paragraph-anchor"></a><b>&#167;3.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Divert an easy case to a simple bitmap lookup</span><span class="named-paragraph-number">3.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">duration</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">        ((</span><span class="identifier-syntax">Occurrence::length</span><span class="plain-syntax">(</span><span class="identifier-syntax">duration</span><span class="plain-syntax">) == -1) &amp;&amp; (</span><span class="identifier-syntax">Occurrence::until</span><span class="plain-syntax">(</span><span class="identifier-syntax">duration</span><span class="plain-syntax">) == -1))) {</span>
<span class="plain-syntax">        </span><a href="5-chr.html#SP5" class="function-link"><span class="function-syntax">Chronology::compile_action_bitmap_test</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ap</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-chr.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_3" class="paragraph-anchor"></a><b>&#167;3.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Make a record of this and queue a request to compile a function to monitor it</span><span class="named-paragraph-number">3.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">past_tense_condition_record</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ptc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">past_tense_condition_record</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">where_ptc_tested</span><span class="plain-syntax"> = </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ap</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">condition</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ap_to_test</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ap</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">condition</span><span class="plain-syntax"> = </span><span class="identifier-syntax">cond</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ap_to_test</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">PR</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP19" class="function-link"><span class="function-syntax">Hierarchy::local_package</span></a><span class="plain-syntax">(</span><span class="constant-syntax">PAST_TENSE_CONDS_HAP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ptc_package</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PR</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ptc_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id_iname</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP12" class="function-link"><span class="function-syntax">Hierarchy::make_iname_in</span></a><span class="plain-syntax">(</span><span class="constant-syntax">PTC_ID_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ptc_package</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-emt.html#SP6" class="function-link"><span class="function-syntax">Emit::numeric_constant</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">id_iname</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">); </span><span class="comment-syntax"> a placeholder: made unique in linking</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">desc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="string-syntax">"past tense condition %d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">allocation_id</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Sequence::queue</span><span class="plain-syntax">(&amp;</span><a href="5-chr.html#SP4" class="function-link"><span class="function-syntax">Chronology::ptc_agent</span></a><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">STORE_POINTER_past_tense_condition_record</span><span class="plain-syntax">(</span><span class="identifier-syntax">ptc</span><span class="plain-syntax">), </span><span class="identifier-syntax">desc</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-chr.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_4" class="paragraph-anchor"></a><b>&#167;3.4. </b>So, then, the function just requested will monitor the past state at intervals
throughout the program's running. By the time code reaches the present position,
then, that past state is available, and can be accessed with a simple function call.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compile a call to TESTSINGLEPASTSTATE</span><span class="named-paragraph-number">3.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">output_wanted</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax"> + </span><span class="identifier-syntax">turns_flag</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">duration</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="5-chr.html#SP9" class="function-link"><span class="function-syntax">Chronology::emit_comparison_operator</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">op</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::call</span></a><span class="plain-syntax">(</span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">TESTSINGLEPASTSTATE_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">((</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">past_flag</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">id_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">(0);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">((</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) (</span><span class="identifier-syntax">output_wanted</span><span class="plain-syntax"> + </span><span class="constant-syntax">4</span><span class="plain-syntax">*</span><span class="identifier-syntax">perfect_flag</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">duration</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">((</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">Occurrence::length</span><span class="plain-syntax">(</span><span class="identifier-syntax">duration</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-chr.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">PM_PastTableEntries_once_only</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Chronology::ptc_agent</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">Chronology::ptc_agent</span></span>:<br/><a href="5-chr.html#SP3_3">&#167;3.3</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">compilation_subtask</span><span class="plain-syntax"> *</span><span class="identifier-syntax">t</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">past_tense_condition_record</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ptc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_past_tense_condition_record</span><span class="plain-syntax">(</span><span class="identifier-syntax">t</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">where_ptc_tested</span><span class="plain-syntax">; </span><span class="comment-syntax"> ensure problems reported correctly</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ptc_iname</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP12" class="function-link"><span class="function-syntax">Hierarchy::make_iname_in</span></a><span class="plain-syntax">(</span><span class="constant-syntax">PTC_FN_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ptc_package</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">packaging_state</span><span class="plain-syntax"> </span><span class="identifier-syntax">save</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Functions::begin</span><span class="plain-syntax">(</span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ptc_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Frames::determines_the_past</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-chr.html#SP4_1" class="named-paragraph-link"><span class="named-paragraph">Compile code to set the new state of the condition, as measured in the present</span><span class="named-paragraph-number">4.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">LocalVariables::are_we_using_table_lookup</span><span class="plain-syntax">()) &amp;&amp; (</span><span class="identifier-syntax">PM_PastTableEntries_once_only</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">PM_PastTableEntries_once_only</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_PastTableEntries</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"it's not safe to look up table entries in a way referring to past history"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"because it leads to dangerous ambiguities. For instance, does 'taking an item "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"listed in the Table of Treasure for the first time' mean that this is the "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"first time taking any of the things in the table, or only the first time "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"this one? And so on."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Functions::end</span><span class="plain-syntax">(</span><span class="identifier-syntax">save</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">md_iname</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP12" class="function-link"><span class="function-syntax">Hierarchy::make_iname_in</span></a><span class="plain-syntax">(</span><span class="constant-syntax">PTC_VALUE_MD_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ptc_package</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-emt.html#SP8" class="function-link"><span class="function-syntax">Emit::iname_constant</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">md_iname</span><span class="plain-syntax">, </span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ptc_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4_1" class="paragraph-anchor"></a><b>&#167;4.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compile code to set the new state of the condition, as measured in the present</span><span class="named-paragraph-number">4.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">condition</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">cond</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">condition</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">TIME_PERIODS</span><span class="plain-syntax">, </span><span class="string-syntax">"Number %d: proposition $D\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">allocation_id</span><span class="plain-syntax">, </span><span class="identifier-syntax">Specifications::to_proposition</span><span class="plain-syntax">(</span><span class="identifier-syntax">cond</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">CreationPredicates::contains_callings</span><span class="plain-syntax">(</span><span class="identifier-syntax">Specifications::to_proposition</span><span class="plain-syntax">(</span><span class="identifier-syntax">cond</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_PastCallings</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="string-syntax">"it's not safe to use '(called ...)' in a way referring to past history"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"because this would make a temporary value to hold the quantity in question, "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"but at a different time from when it would be needed."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RETURN_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">CompileValues::to_code_val</span><span class="plain-syntax">(</span><span class="identifier-syntax">cond</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RETURN_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="5-chr.html#SP5" class="function-link"><span class="function-syntax">Chronology::compile_action_bitmap_test</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ptc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ap_to_test</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-chr.html#SP4">&#167;4</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>This, then, is the easy case of testing something like "if we have looked".
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Chronology::compile_action_bitmap_test</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">Chronology::compile_action_bitmap_test</span></span>:<br/><a href="5-chr.html#SP3_2">&#167;3.2</a>, <a href="5-chr.html#SP4_1">&#167;4.1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">action_pattern</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ap</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">bad_form</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::call</span></a><span class="plain-syntax">(</span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">TESTACTIONBITMAP_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">APClauses::spec</span><span class="plain-syntax">(</span><span class="identifier-syntax">ap</span><span class="plain-syntax">, </span><span class="identifier-syntax">NOUN_AP_CLAUSE</span><span class="plain-syntax">) == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">(0);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">CompileValues::to_code_val</span><span class="plain-syntax">(</span><span class="identifier-syntax">APClauses::spec</span><span class="plain-syntax">(</span><span class="identifier-syntax">ap</span><span class="plain-syntax">, </span><span class="identifier-syntax">NOUN_AP_CLAUSE</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">L</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ActionNameLists::length</span><span class="plain-syntax">(</span><span class="identifier-syntax">ap</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">action_list</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">L</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">((</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) -1);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">anl_item</span><span class="plain-syntax"> *</span><span class="identifier-syntax">item</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ActionNameLists::first_item</span><span class="plain-syntax">(</span><span class="identifier-syntax">ap</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">action_list</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">L</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">) </span><span class="identifier-syntax">bad_form</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">item</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">action_listed</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">bad_form</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ActionSemantics::can_be_compiled_in_past_tense</span><span class="plain-syntax">(</span><span class="identifier-syntax">item</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">action_listed</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">bad_form</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><a href="5-act2.html#SP6" class="function-link"><span class="function-syntax">RTActions::double_sharp</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">item</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">action_listed</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">APClauses::viable_in_past_tense</span><span class="plain-syntax">(</span><span class="identifier-syntax">ap</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="identifier-syntax">bad_form</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bad_form</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="5-chr.html#SP5_1" class="named-paragraph-link"><span class="named-paragraph">Issue too complex PT problem</span><span class="named-paragraph-number">5.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5_1" class="paragraph-anchor"></a><b>&#167;5.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue too complex PT problem</span><span class="named-paragraph-number">5.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_PTAPTooComplex</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="string-syntax">"that is too complex a past tense action"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"at least for this version of Inform to handle: we may improve matters in later "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"releases. The restriction is that the actions used in the past tense may take at "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"most one object, and that this must be a physical thing (not a value, in other "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"words). And no details of where or what else was then happening can be specified."</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-chr.html#SP5">&#167;5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. Action history conditions.</b>An "action history condition" is subtly different: for example, "if taking
something edible for the third turn". Reference is made to the past, by implication,
but the action itself is referred to in the present tense. (Whereas "if we have
taken something" would be a past tense condition: see above.)
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">action_history_condition_record</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">action_pattern</span><span class="plain-syntax"> </span><span class="identifier-syntax">historic_action</span><span class="plain-syntax">; </span><span class="comment-syntax"> action pattern to be matched</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">where_ahcr_tested</span><span class="plain-syntax">; </span><span class="comment-syntax"> sentence in which AP is found</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ahcr_package</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ahcr_iname</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">action_history_condition_record</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure action_history_condition_record is private to this section.</li></ul>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. </b>The <span class="extract"><span class="extract-syntax">duration</span></span> here records the "for the third turn" part; the <span class="extract"><span class="extract-syntax">ap</span></span>, the
"taking something edible" part.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Chronology::compile_action_history_condition</span><span class="plain-syntax">(</span><span class="identifier-syntax">time_period</span><span class="plain-syntax"> *</span><span class="identifier-syntax">duration</span><span class="plain-syntax">, </span><span class="identifier-syntax">action_pattern</span><span class="plain-syntax"> </span><span class="identifier-syntax">ap</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">op</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Occurrence::operator</span><span class="plain-syntax">(</span><span class="identifier-syntax">duration</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">op</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NO_REPM</span><span class="plain-syntax">) </span><span class="identifier-syntax">op</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EQ_REPM</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">PR</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP19" class="function-link"><span class="function-syntax">Hierarchy::local_package</span></a><span class="plain-syntax">(</span><span class="constant-syntax">ACTION_HISTORY_CONDS_HAP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ahc_function</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP12" class="function-link"><span class="function-syntax">Hierarchy::make_iname_in</span></a><span class="plain-syntax">(</span><span class="constant-syntax">AHC_FN_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">PR</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">TIME_PERIODS</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"Chronology::compile_action_history_condition on: $A\nat: $t\n"</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">ap</span><span class="plain-syntax">, </span><span class="identifier-syntax">duration</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ActionPatterns::makes_callings</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">ap</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_PTAPMakesCallings</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"a description of an action cannot both refer to past history and also use "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"'(called ...)'"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"because that would require Inform in general to remember too much information "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"about past events."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">id_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-chr.html#SP7_1" class="named-paragraph-link"><span class="named-paragraph">Make a record of the need for this AHC and queue a request to compile it</span><span class="named-paragraph-number">7.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-chr.html#SP7_2" class="named-paragraph-link"><span class="named-paragraph">Compile code to perform the test in the here and now</span><span class="named-paragraph-number">7.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7_1" class="paragraph-anchor"></a><b>&#167;7.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Make a record of the need for this AHC and queue a request to compile it</span><span class="named-paragraph-number">7.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">action_history_condition_record</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ahcr</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">action_history_condition_record</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ahcr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">where_ahcr_tested</span><span class="plain-syntax"> = </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ahcr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">historic_action</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ap</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ahcr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ahcr_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ahc_function</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ahcr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ahcr_package</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PR</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">desc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="string-syntax">"past tense action %d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">ahcr</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">allocation_id</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Sequence::queue</span><span class="plain-syntax">(&amp;</span><a href="5-chr.html#SP8" class="function-link"><span class="function-syntax">Chronology::ahcr_agent</span></a><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">STORE_POINTER_action_history_condition_record</span><span class="plain-syntax">(</span><span class="identifier-syntax">ahcr</span><span class="plain-syntax">), </span><span class="identifier-syntax">desc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id_iname</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP12" class="function-link"><span class="function-syntax">Hierarchy::make_iname_in</span></a><span class="plain-syntax">(</span><span class="constant-syntax">AHC_ID_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">ahcr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ahcr_package</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-emt.html#SP6" class="function-link"><span class="function-syntax">Emit::numeric_constant</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">id_iname</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">); </span><span class="comment-syntax"> a placeholder: made unique in linking</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-chr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_2" class="paragraph-anchor"></a><b>&#167;7.2. </b>The test compiled here relies entirely on a slew of arrays being correctly
maintained. Those arrays are all managed by code compiled in linking (see
<a href="../pipeline-module/5-chr.html" class="internal">Chronology (in pipeline)</a>, code which has regularly been calling our own AHC
function throughout play.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compile code to perform the test in the here and now</span><span class="named-paragraph-number">7.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">AND_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">INDIRECT0_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">ahc_function</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">L</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Occurrence::length</span><span class="plain-syntax">(</span><span class="identifier-syntax">duration</span><span class="plain-syntax">), </span><span class="identifier-syntax">U</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Occurrence::until</span><span class="plain-syntax">(</span><span class="identifier-syntax">duration</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">units</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Occurrence::units</span><span class="plain-syntax">(</span><span class="identifier-syntax">duration</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">L</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">L</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">U</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">units</span><span class="plain-syntax"> == </span><span class="identifier-syntax">TIMES_UNIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">AND_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">LE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">((</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">L</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">LOOKUP_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                            </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">TIMESACTIONHASHAPPENED_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">id_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">AND_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">((</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">U</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">LOOKUP_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                            </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                                </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">TIMESACTIONHASHAPPENED_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                            </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">id_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">LOOKUPBYTE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                            </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ACTIONCURRENTLYHAPPENINGFLAG_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">id_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">AND_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">LE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">((</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">L</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">LOOKUP_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                            </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">TURNSACTIONHASBEENHAPPENING_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">id_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">((</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">U</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">LOOKUP_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                            </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">TURNSACTIONHASBEENHAPPENING_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">id_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">units</span><span class="plain-syntax"> == </span><span class="identifier-syntax">TIMES_UNIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">AND_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="5-chr.html#SP9" class="function-link"><span class="function-syntax">Chronology::emit_comparison_operator</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">op</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">LOOKUP_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                            </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">TIMESACTIONHASHAPPENED_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                        </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">id_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">((</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">L</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">LOOKUPBYTE_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                        </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ACTIONCURRENTLYHAPPENINGFLAG_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">id_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><a href="5-chr.html#SP9" class="function-link"><span class="function-syntax">Chronology::emit_comparison_operator</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">op</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">LOOKUP_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                        </span><a href="2-hrr.html#SP11" class="function-link"><span class="function-syntax">Hierarchy::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">TURNSACTIONHASBEENHAPPENING_HL</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                    </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">id_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><a href="2-ec.html#SP8" class="function-link"><span class="function-syntax">EmitCode::val_number</span></a><span class="plain-syntax">((</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">L</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-chr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. </b>The AHC function is very simple: it returns true if the current action matches
the pattern, and otherwise false.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">PM_PastTableLookup_once_only</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Chronology::ahcr_agent</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">Chronology::ahcr_agent</span></span>:<br/><a href="5-chr.html#SP7_1">&#167;7.1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">compilation_subtask</span><span class="plain-syntax"> *</span><span class="identifier-syntax">t</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">action_history_condition_record</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ahcr</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RETRIEVE_POINTER_action_history_condition_record</span><span class="plain-syntax">(</span><span class="identifier-syntax">t</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ahcr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">where_ahcr_tested</span><span class="plain-syntax">; </span><span class="comment-syntax"> ensure problems reported correctly</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">packaging_state</span><span class="plain-syntax"> </span><span class="identifier-syntax">save</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Functions::begin</span><span class="plain-syntax">(</span><span class="identifier-syntax">ahcr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ahcr_iname</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IF_BIP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ActionPatterns::convert_to_present_tense</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">ahcr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">historic_action</span><span class="plain-syntax">)); </span><span class="comment-syntax"> prevent recursion</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RTActionPatterns::compile_pattern_match</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">ahcr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">historic_action</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP5" class="function-link"><span class="function-syntax">EmitCode::code</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::down</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><a href="2-ec.html#SP15" class="function-link"><span class="function-syntax">EmitCode::rtrue</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">EmitCode::up</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-ec.html#SP15" class="function-link"><span class="function-syntax">EmitCode::rfalse</span></a><span class="plain-syntax">();</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">LocalVariables::are_we_using_table_lookup</span><span class="plain-syntax">()) &amp;&amp; (</span><span class="identifier-syntax">PM_PastTableLookup_once_only</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">PM_PastTableLookup_once_only</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_PastTableLookup</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"it's not safe to look up table entries in a way referring to past history"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"because it leads to dangerous ambiguities. For instance, does 'taking an item "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"listed in the Table of Treasure for the first time' mean that this is the "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"first time taking any of the things in the table, or only the first time "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"this one? And so on."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">Functions::end</span><span class="plain-syntax">(</span><span class="identifier-syntax">save</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">md_iname</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP12" class="function-link"><span class="function-syntax">Hierarchy::make_iname_in</span></a><span class="plain-syntax">(</span><span class="constant-syntax">AHC_VALUE_MD_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">ahcr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ahcr_package</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-emt.html#SP8" class="function-link"><span class="function-syntax">Emit::iname_constant</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">md_iname</span><span class="plain-syntax">, </span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">ahcr</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ahcr_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. Utility.</b>Last and very much least:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Chronology::emit_comparison_operator</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">Chronology::emit_comparison_operator</span></span>:<br/><a href="5-chr.html#SP3_4">&#167;3.4</a>, <a href="5-chr.html#SP7_2">&#167;7.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">op</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">op</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">EQ_REPM:</span><span class="plain-syntax"> </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">EQ_BIP</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">LT_REPM:</span><span class="plain-syntax"> </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">LT_BIP</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">LE_REPM:</span><span class="plain-syntax"> </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">LE_BIP</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">GT_REPM:</span><span class="plain-syntax"> </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GT_BIP</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">GE_REPM:</span><span class="plain-syntax"> </span><a href="2-ec.html#SP14" class="function-link"><span class="function-syntax">EmitCode::inv</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">GE_BIP</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">default:</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"unimplemented operator"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="5-adj.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-rm.html">1</a></li><li class="progresschapter"><a href="2-hrr.html">2</a></li><li class="progresschapter"><a href="3-gm.html">3</a></li><li class="progresschapter"><a href="4-enc.html">4</a></li><li class="progresscurrentchapter">5</li><li class="progresssection"><a href="5-act.html">act</a></li><li class="progresssection"><a href="5-adj.html">adj</a></li><li class="progresscurrent">chr</li><li class="progresssection"><a href="5-cnj.html">cnj</a></li><li class="progresssection"><a href="5-eqt.html">eqt</a></li><li class="progresssection"><a href="5-ins.html">ins</a></li><li class="progresssection"><a href="5-bi.html">bi</a></li><li class="progresssection"><a href="5-di.html">di</a></li><li class="progresssection"><a href="5-ri.html">ri</a></li><li class="progresssection"><a href="5-si.html">si</a></li><li class="progresssection"><a href="5-mlt.html">mlt</a></li><li class="progresssection"><a href="5-tbl.html">tbl</a></li><li class="progresssection"><a href="5-tc.html">tc</a></li><li class="progresssection"><a href="5-dbi.html">dbi</a></li><li class="progresssection"><a href="5-dli.html">dli</a></li><li class="progresssection"><a href="5-dci.html">dci</a></li><li class="progresssection"><a href="5-rls.html">rls</a></li><li class="progresssection"><a href="5-rlb.html">rlb</a></li><li class="progresssection"><a href="5-vrb.html">vrb</a></li><li class="progresssection"><a href="5-prp.html">prp</a></li><li class="progresssection"><a href="5-rlt.html">rlt</a></li><li class="progresssection"><a href="5-lp.html">lp</a></li><li class="progresssection"><a href="5-kc.html">kc</a></li><li class="progresssection"><a href="5-ki.html">ki</a></li><li class="progresssection"><a href="5-act2.html">act2</a></li><li class="progresssection"><a href="5-nap.html">nap</a></li><li class="progresssection"><a href="5-ts.html">ts</a></li><li class="progresschapter"><a href="6-bd.html">6</a></li><li class="progresschapter"><a href="7-cg.html">7</a></li><li class="progressnext"><a href="5-cnj.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

